# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api


class QcInspection(models.Model):
    _inherit = 'qc.inspection'

    @api.one
    @api.depends('object_id')
    def get_rs(self):
        self.rs = False
        print(self.object_id)
        if self.object_id:
            print(self.object_id.name)
            if self.object_id._name == 'reinforcement.scheme':
                self.rs = self.object_id
                print(self.object_id)
        print(self.object_id)

    rs = fields.Many2one(
        comodel_name="reinforcement.scheme", compute="get_rs", store=True)


class QcInspectionLine(models.Model):
    _inherit = 'qc.inspection.line'

    rs = fields.Many2one(
        comodel_name="reinforcement.scheme", related="inspection_id.rs",
        store=True)